package string;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        long I = 1234567890987654321L;
        String str = I+"";
        System.out.println(str.length());
        //练习三
        String str1 = "文件.MP4";
        boolean b = str1.endsWith("MP4");
        System.out.println(b);
        //3
        Scanner sc1 = new Scanner(System.in);
        System.out.println("请输入文件名字");
        String str3 = sc1.nextLine();
        CheckFile(str3);

        //练习四
        String[] str2 = {"张三","李四","王五","赵六","周七","王哲","白浩","贾蓉","慕容阿三","黄蓉"};
        for (int i = 0; i < str2.length; i++) {
            for (int j = i+1; j < str2.length; j++) {
                int s = str2[i].length();
                char endChar = str2[i].charAt(s - 1);
                String sb = endChar + "";
                if (str2[j].endsWith(sb)) {
                    System.out.println(str2[i] + str2[j]);
                }
            }
        }
        //4
        String[] str4 = {"张三","李四","王五","赵六","周七","王哲","白浩","贾蓉","慕容阿三","黄蓉"};
        for (int i = 0; i < str4.length; i++) {
            char endChar = str4[i].charAt(str4[i].length() - 1);
            for (int j = i+1; j < str4.length; j++) {
                boolean flag = str4[i].endsWith(endChar + "");
                if (flag)
                System.out.println(str4[i] + str4[j]);
            }
        }


        //练习七
        String books[][] = {
                {"《Java语言》", "《Java Web语言》", "《C语言》", "《C++语言》", "《Linux C语言》"},
                {"《论语》", "《资治通鉴》", "《四十二章经》", "《史记》", "《隋唐史》"}};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您要搜索的书名或关键字：");
        String message = sc.next();
        System.out.println("--------------搜索结果--------------");
        for (int i = 0; i < books.length; i++) {
            for (int j = 0; j < books[i].length; j++) {
                if (books[i][j].equals(message)) {
                    System.out.println(books+"在"+(i+1)+"和"+(j+1));
                }
            }
        }

        //练习八
        String[] str5={"mrsoft","mr","miss","Admin"};
        boolean flag = true;
        do {
            System.out.println("请输入名字");
            String webName = sc.next();
            for (int i = 0; i < str5.length; i++) {
                if (webName.equals(str5[i])) {
                    System.out.println("已注册过");
                }
            }
        }while(flag);
    }

    private static void CheckFile(String str3) {
        String result=str3.toUpperCase().endsWith("MP4") ?"是":"不是";
        System.out.println(result);
    }
}
